<?php
// 积分墙 - 点击接口 【口袋ATM】 快速任务 不需回调 callback 为空

$cid = 1; // 口袋ATM
$appid = intval($_REQUEST['appid']);
$idfa = inputFilter($_REQUEST['idfa']);
$mac = inputFilter($_REQUEST['mac']);
$callback_url = trim($_REQUEST['callback']);
$now = time();

if(empty($idfa) || !isset($_REQUEST['appid'])){
    // echo '400';exit;
    echo json_encode(array('status'=>false));exit;
}

if(!check_record($appid, $idfa)){
    // echo '400';exit;
    echo json_encode(array('status'=>false));exit;
}else{

    exec_db("INSERT INTO tttj.jfq_record (cid,appid,idfa,callback_url,ctime,mac) VALUES ('{$cid}','{$appid}','{$idfa}','{$callback_url}','{$now}','{$mac}')");

    exec_db("INSERT INTO tttj.jfq_kdrecord (appid,idfa,cid) VALUES ('{$appid}','{$idfa}','{$cid}')");

    // echo '200';exit;
    echo json_encode(array('status'=>true));exit;
}
